package com.panfeng.xcloud.scheduler.service;

import com.alibaba.fastjson.JSONObject;
import com.panfeng.xcloud.boss.provider.dto.request.QuantBotDetailDTO;
import com.panfeng.xcloud.common.core.candle.MyCandleEntry;
import com.panfeng.xcloud.scheduler.dto.SlowStochRsiResult;
import com.panfeng.xcloud.scheduler.dto.SupertrendResult;
import org.ta4j.core.BarSeries;
import org.ta4j.core.num.Num;

import java.math.BigDecimal;
import java.time.Duration;
import java.util.List;

public interface ITechniqueSymbolService4BackTest {

    /**
     * 获取某根蜡烛
     */
    List<MyCandleEntry> getCandlerStick(JSONObject candleStick) throws Exception;

    /**
     * 开多趋势中突破判断
     */
    QuantBotDetailDTO[] judgeTrendBuyBreakThroughOpen(JSONObject candleStick5m, int atrPeriod, QuantBotDetailDTO quantBotDetailDTO, BarSeries barSeries, String destinationCoins, BigDecimal slippage) throws Exception;

    QuantBotDetailDTO[] judgeTrendBuyBreakThroughOpen2(JSONObject candleStick5m, int atrPeriod, QuantBotDetailDTO quantBotDetailDTO, BarSeries barSeries, String destinationCoins, BigDecimal slippage) throws Exception;

    /**
     * 开空趋势中突破判断
     */
    QuantBotDetailDTO[] judgeTrendSellBreakThroughOpen(JSONObject candleStick5m, int atrPeriod, QuantBotDetailDTO quantBotDetailDTO, BarSeries barSeries, String destinationCoins, BigDecimal slippage) throws Exception;

    QuantBotDetailDTO[] judgeTrendSellBreakThroughOpen2(JSONObject candleStick5m, int atrPeriod, QuantBotDetailDTO quantBotDetailDTO, BarSeries barSeries, String destinationCoins, BigDecimal slippage) throws Exception;

    BarSeries getBarSeries(List<MyCandleEntry> candleEntries, Duration timePeriod);

    List<Num>[] getMACD_signal_value(BarSeries barSeries, int shortPeriod, int longPeriod, int signalPeriod);

    List<Num> getATR(BarSeries barSeries, int atrPeriod);

    BigDecimal getRsi(BarSeries barSeries, int rsiTimeFrame, int index);

    boolean isMACDBottom(double[] macdValues);

    boolean isMACDTop(double[] macdValues);

    Num[] getStochRsi(BarSeries series, int rsiBarCount, int stockBarCount, int kPeriod, int dPeriod, int index);

    double getADX(BarSeries series, int diBarCount, int adxBarCount, int index);

    double getCCI(BarSeries series, int cciPeriod, int index);

    double getOBV(BarSeries series, int index);

    SlowStochRsiResult getSlowStochRsi(BarSeries barSeries, int length, int smoothK, int smoothD, int index);

    SupertrendResult calculateSupertrend(BarSeries series, float factor, int atrPeriod, int index);

}
